// 夜间模式
let nightBtn = document.getElementById("nightMod");

let sunBtn = document.getElementById("sunMod");

var isNight = false;
// 夜间模式
nightBtn.onclick = function(){
    document.body.style.color = "#C20C0C";
    document.body.style.backgroundColor = "#242424";
    document.getElementById("topLogoIco").setAttribute("src","./img/头部夜间logo.png")
    document.getElementById("bannerImg").setAttribute("src","./img/homepage夜间.jpg");
    document.getElementsByClassName("userInfo")[0].style.backgroundColor = "#242424";
    let h2Array =document.getElementsByTagName("h2");
    for(let i=0 ; i<4 ; i++){
        h2Array[i].style.color = "red";
    }
    let h3Array =document.getElementsByTagName("h3");
    for(let i=0 ; i<h3Array.length ; i++){
        h3Array[i].style.color = "red";
    }
    let btnArray =document.getElementsByClassName("nomal");
    for(let i=0 ; i<btnArray.length ;i++){
        btnArray[i].style.backgroundColor="red";
        btnArray[i].style.color = "white";
        if(btnArray[i].getAttribute("class")=="pageBtn actived"){
            btnArray[i].style.backgroundColor="white";
            btnArray[i].style.color = "red"
        }
    }
   isNight = true;
}

// 日间模式
sunBtn.onclick = function(){
    document.body.style.color = "#737373";
    document.body.style.backgroundColor = "white";
    document.getElementById("topLogoIco").setAttribute("src","./img/头部logo.png")
    document.getElementById("bannerImg").setAttribute("src","./img/homepage.png");
    document.getElementsByClassName("userInfo")[0].style.backgroundColor = "white";
    let h2Array =document.getElementsByTagName("h2");
    for(let i=0 ; i<4 ; i++){
        h2Array[i].style.color = "#292929";
    }
    let h3Array =document.getElementsByTagName("h3");
    for(let i=0 ; i<h3Array.length ; i++){
        h3Array[i].style.color = "black";
    }
    let btnArray =document.querySelectorAll(".pageBtn");
    for(let i=0 ; i<btnArray.length ;i++){
        btnArray[i].style.backgroundColor="#0f9cf5";
        btnArray[i].style.color = "white";
       
       if(btnArray[i].getAttribute("class")=="pageBtn actived"){
           btnArray[i].style.backgroundColor="white";
           btnArray[i].style.color = "#0f9cf5"
       }
    }
    isNight = false;
}